package cn.com.fssg.platform.base.handler.impl;

import cn.com.fssg.platform.base.handler.InterfaceHandler;
import cn.com.fssg.platform.biz.BizUtil;
import cn.com.fssg.platform.biz.ExtendUtil;
import com.alibaba.fastjson.JSONObject;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class InterfaceHandlerExtend implements InterfaceHandler {

    private NamedParameterJdbcTemplate jdbcTemplate = BizUtil.cur().tenantMainJdbcTemplate();

    @Override
    public Object run(HttpServletRequest request, JSONObject jsonObject) {
        /*String value = jsonObject.getString("key");
        String sql = "select * from cfg_custom_handler where class_name = :className";
        HashMap<String,Object> params = new HashMap<>();
        params.put("className", value);
        List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sql, params);*/

       /* Object result = ExtendUtil.cur().login(jsonObject);
        System.out.println(result);*/

        Object result = null;
        try {
            result = ExtendUtil.cur().logout(jsonObject.getString("token"));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        return result;
    }

}
